#ifndef __LCD_H
#define __LCD_H	   						  

#include "stdlib.h"	  

#define USE_HORIZONTAL 1  

#if USE_HORIZONTAL==0||USE_HORIZONTAL==1

#define LCD_W 128
#define LCD_H 160

#else
#define LCD_W 160
#define LCD_H 128
#endif

#define	u8 unsigned char
#define	u16 unsigned int
#define	u32 unsigned long

#define LCD_SCL_Pin     9
#define LCD_SDA_Pin     8
#define LCD_RES_Pin     0
#define LCD_DC_Pin      2
#define LCD_CS_Pin      5
#define LCD_BL_Pin      12


#define OLED_SCLK_Clr() digitalWrite(LCD_SCL_Pin,LOW)//SCL
#define OLED_SCLK_Set() digitalWrite(LCD_SCL_Pin,HIGH)

#define OLED_SDIN_Clr() digitalWrite(LCD_SDA_Pin,LOW)//DIN
#define OLED_SDIN_Set() digitalWrite(LCD_SDA_Pin,HIGH)

#define OLED_RES_Clr() digitalWrite(LCD_RES_Pin,LOW)//RES
#define OLED_RES_Set() digitalWrite(LCD_RES_Pin,HIGH)

#define OLED_DC_Clr() digitalWrite(LCD_DC_Pin,LOW)//DC
#define OLED_DC_Set() digitalWrite(LCD_DC_Pin,HIGH)
 		     
#define OLED_CS_Clr()  digitalWrite(LCD_CS_Pin,LOW)//CS
#define OLED_CS_Set()  digitalWrite(LCD_CS_Pin,HIGH)

#define OLED_BLK_Clr()  digitalWrite(LCD_BL_Pin,LOW)//BLK
#define OLED_BLK_Set()  digitalWrite(LCD_BL_Pin,HIGH)

#define OLED_CMD  0	
#define OLED_DATA 1	


extern  u16 BACK_COLOR;  
void Delay_ms(unsigned int time);
void LCD_Writ_Bus(u8 dat);
void LCD_WR_DATA8(u8 dat);
void LCD_WR_DATA(u16 dat);
void LCD_WR_REG(u8 dat);
void LCD_Address_Set(u16 x1,u16 y1,u16 x2,u16 y2);
void Lcd_Init(void); 
void LCD_Clear(u16 Color);
void LCD_ShowChinese(u16 x,u16 y,u8 index,u8 size,u16 color);
void LCD_DrawPoint(u16 x,u16 y,u16 color);
void LCD_DrawPoint_big(u16 x,u16 y,u16 colory);
void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color);
void LCD_DrawLine(u16 x1,u16 y1,u16 x2,u16 y2,u16 color);
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2,u16 color);
void Draw_Circle(u16 x0,u16 y0,u8 r,u16 color);
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 mode,u16 color);
void LCD_ShowString(u16 x,u16 y,const u8 *p,u16 color);
u32 mypow(u8 m,u8 n);
void LCD_ShowNum(u16 x,u16 y,u16 num,u8 len,u16 color);
void LCD_ShowNum1(u16 x,u16 y,float num,u8 len,u16 color);
void LCD_ShowPicture(u16 x1,u16 y1,u16 x2,u16 y2);

#define WHITE         	        0xFFFF
#define BLACK         	        0x0000	  
#define BLUE           	        0x001F  
#define BRED                    0XF81F
#define GRED 			        0XFFE0
#define GBLUE			        0X07FF
#define RED           	        0xF800
#define MAGENTA       	        0xF81F
#define GREEN         	        0x07E0
#define CYAN          	        0x7FFF
#define YELLOW        	        0xFFE0
#define BROWN 			        0XBC40 
#define BRRED 			        0XFC07 
#define GRAY  			        0X8430 

#define DARKBLUE      	        0X01CF
#define LIGHTBLUE      	        0X7D7C
#define GRAYBLUE       	        0X5458
#define LIGHTGREEN     	        0X841F 
#define LGRAY 			        0XC618 
#define LGRAYBLUE               0XA651
#define LBBLUE                  0X2B12 
		  		 
#endif   		     



